#ifndef BDFACEENGINE_H
#define BDFACEENGINE_H

#include <QObject>
#include <QString>
//#include "curl/curl.h"
#include <QNetworkAccessManager>

class BdFaceEngine : public QObject
{
    Q_OBJECT
public:
    explicit BdFaceEngine(QObject *parent = nullptr);
public slots:
    int register_face(const QString &imgpath, const QString & user_info, int user_id);
    int search_face(const QString &imgpath);

signals:
    void register_done(const int id);
    void search_done(const int id);//query_face完成之后释放的信号，包含了user_id
private:
    bool refresh_token();
    int register_face_core(const QString &qstrImage, const QString & user_info, int user_id);
    int search_face_core(QString &qstrImage);

    QString build_imgstr(const QString &imgpath);
    QString build_imgstr(QPixmap &image);
    QString build_imgstr(QByteArray &bytearray);

private:
    QNetworkAccessManager m_http;
    //认证所需要的参数
    QString m_apiKey;
    QString m_secretKey;
    QString m_token;

    double m_dThresholdValue;
};

#endif // BDFACEENGINE_H
